﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DacSanMienTayOBJ;
using System.Text;
public partial class Proccess_UpdateAdvNamePosition : System.Web.UI.Page
{
    private void UpdateAdvPositionName()
    {
        try
        {
            int advID = int.Parse(Request["advID"]);
            string advName = Request["advName"];
            int vt = int.Parse(Request["vt"]);
            int visible=int.Parse(Request["visible"]);
            StringBuilder builder = new StringBuilder();

            bool rs = AdvPositionBusiness.UpdateAdvPosition(advID, advName, ConnectionType.AdminConnection);
            if (rs)
            {
                string status="";
                if(visible==1)
                {
                    status="Active";
                }
                else
                {
                    status="Inactive";
                }
               builder.Append("<td><label id=\"lbAdvID"+vt+"\" title=\""+advID+"\">"+advID+"</label></td>");
                builder.Append("<td><input type=\"text\" style=\"width:350px\" value=\""+advName+"\" id=\"txtName"+vt+"\" /> </td>");
                builder.Append("<td>"+status+"</td>");
                builder.Append("<td><input type=\"button\" value=\"Cập nhật\" onclick=\"UpdateAdvName('"+advID+"','"+vt+"','"+visible+"')\" /> </td>");
                builder.Append("<td>");
                if (visible== 1)
                {
                    builder.Append("<input type=\"button\" value=\"Lock\" onclick=\"LockAndUnclockAdvPosition('"+advID+"','"+vt+"','lock','"+visible+"')\" />");
                }
                else
                {

                    builder.Append("<input type=\"button\" value=\"UnLock\" onclick=\"LockAndUnclockAdvPosition('" + advID + "','" + vt + "','unlock','" + visible + "')\" />");

                }
               builder.Append("</td>");
               Response.Write(builder);
            }
            else
            {
                Response.Write("errorupdateadvname");
            }
            Response.End();
        }
        catch
        {

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        UpdateAdvPositionName();
    }
}